Insecure Bank2 취약점(2)

Insecure Bank2 취약점(2)

Description
취약한 인증 메커니즘
category
MobileHacking
Tag
Mobile Security
Andorid
Date
Jan 18, 2024 06:51 AM

취약한 인증 메커니즘

취약한 인증 메커니즘이란?

정상적인 인증 절차를 거치지 않고 접근 권한을 취득하는 취약점이다.
아래 같은 경우에 해당하면 취약한 인증 메커니즘 취약점에 해당된다.
  • 적절하지 않은 앱 퍼미션 설정 여부
  • 서비스 권한 상승 행위에 대한 통제 여부
  • 기능에 대한 제한 또는 우회 금지 여부
  • 불필요하거나 사용하지 않는 액티비티 제거 여부
  • 인텐트 사용에 대한 안정성 여부
  • 마스터 키 취약점 대응 여부
 

취약점 진단

해당 취약점은 AndroidManifest.xml에서 확인 할 수 있었다.
코드를 살펴보면 android:export 부분이 True로 설정되어 있는 것을 알 수 있다.
이 경우 다른 액티비티에서 해당 액티비티에 인증없이 접근이 가능하다.
다시 말해 PostLogin, DoTransfer, ViewStatement는 인증 없이 접근 가능하다.
<application android:theme="@android:style/Theme.Holo.Light.DarkActionBar" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:debuggable="true" android:allowBackup="true"> <activity android:label="@string/app_name" android:name="com.android.insecurebankv2.LoginActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="@string/title_activity_file_pref" android:name="com.android.insecurebankv2.FilePrefActivity" android:windowSoftInputMode="adjustNothing|stateVisible"/> <activity android:label="@string/title_activity_do_login" android:name="com.android.insecurebankv2.DoLogin"/> <activity android:label="@string/title_activity_post_login" android:name="com.android.insecurebankv2.PostLogin" android:exported="true"/> <activity android:label="@string/title_activity_do_transfer" android:name="com.android.insecurebankv2.DoTransfer" android:exported="true"/> <activity android:label="@string/title_activity_view_statement" android:name="com.android.insecurebankv2.ViewStatement" android:exported="true"/> <provider android:name="com.android.insecurebankv2.TrackUserContentProvider" android:exported="true" android:authorities="com.android.insecurebankv2.TrackUserContentProvider"/> <receiver android:name="com.android.insecurebankv2.MyBroadCastReceiver" android:exported="true"> <intent-filter> <action android:name="theBroadcast"/> </intent-filter> </receiver> <activity android:label="@string/title_activity_change_password" android:name="com.android.insecurebankv2.ChangePassword" android:exported="true"/> <activity android:theme="@android:style/Theme.Translucent" android:name="com.google.android.gms.ads.AdActivity" android:configChanges="smallestScreenSize|screenSize|uiMode|screenLayout|orientation|keyboardHidden|keyboard"/> <activity android:theme="@style/Theme.IAPTheme" android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"/> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/> <receiver android:name="com.google.android.gms.wallet.EnableWalletOptimizationReceiver" android:exported="false"> <intent-filter> <action android:name="com.google.android.gms.wallet.ENABLE_WALLET_OPTIMIZATION"/> </intent-filter> </receiver> </application>
 
android:exported 에 관련된 자세한 설명은 아래 링크에서 확인 가능하다.
 

ADB를 통해 모의해킹

am를 통해 com.android.insecurebankv2.PostLogin 액티비티를 호출 보았다.
am start com.android.insecurebankv2/com.android.insecurebankv2.PostLogin
액티비티 호출 ADB 명령어
 
다음과 같이 정상적인 인증 절차 없이 로그인 된 것을 알 수 있다.
notion image
 

Drozer를 통한 모의해킹

Drozer를 통해 com.android.insecurebankv2.PostLogin 액티비티를 호출 보았다.
run app.activity.start --component com.android.insecurebankv2 com.android.insecurebankv2.PostLogin
액티비티 호츨 Drozer 명령어
 
다음과 같이 정상적인 인증 절차 없이 로그인 된 것을 알 수 있다.
notion image
 

대응방안

AndroidManifest.xml의 코드의 android:exported:”true”을 android:exported:”false” 로 변경해주면 된다.